package interview.Sorting;

public class ShellSort {
	public static void sort(int[] num){
		int newValue,pos,hSort;
		hSort=5;
		while(hSort>0){
			for(int i=hSort;i<num.length;i++){
				newValue=i;
				pos=i-hSort;
				while(true){				
					if( (pos>=0) &&(num[newValue]<num[pos])){
						Generic.swap(num,newValue,pos);
						newValue= pos;
						pos=pos-hSort;
					}
					else
						break;
				}				
			}
			System.out.print(" \nHSort After " + hSort+" :");
			Generic.printArray(num);
			hSort=hSort-2;
		}		
	}
}
